#!ipxe

isset ${dhcp-server} && set ipparam ip=dhcp || set ipparam ip=${ip}::${gateway}:${netmask}:::none nameserver=${dns}
set ipparam BOOTIF=${netX/mac} ${ipparam}

goto ${menu} ||

:live_menu
set os Fedora Live
menu ${os} - Current Arch [ ${arch} ]
iseq ${arch} x86_64 && set arch_a amd64 || set arch_a ${arch}
item --gap ${os} Versions
item 32 ${space} ${os} 32
item 31 ${space} ${os} 31
choose live_version || goto live_exit
menu ${os} ${live_version}
item --gap ${os} Flavors
goto ${live_version}

:32
{% for key, value in endpoints.items() | sort %}
{% if value.os == "fedora" and value.version == 32 %}
item {{ key }} ${space} {{ value.os | title }} {{ value.version }} {{ value.flavor | title}}
{% endif %}
{% endfor %}
goto flavor_select

:31
{% for key, value in endpoints.items() | sort %}
{% if value.os == "fedora" and value.version == 31 %}
item {{ key }} ${space} {{ value.os | title }} {{ value.version }} {{ value.flavor | title}}
{% endif %}
{% endfor %}
goto flavor_select

:flavor_select
choose flavor || goto live_menu
echo ${cls}
goto ${flavor} ||

{% for key, value in endpoints.items() | sort %}
{% if value.os == "fedora" %}
:{{ key }}
set live_url ${live_endpoint}{{ value.path }}
goto boot
{% endif %}
{% endfor %}

:boot
imgfree
kernel ${live_url}vmlinuz ${ipparam} root=live:${live_url}squashfs.img ro rd.live.image rd.lvm=0 rd.luks=0 rd.md=0 rd.dm=0 initrd=initrd ${cmdline}
initrd ${live_url}initrd
boot

:live_exit
clear menu
exit 0

